<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ page import="com.sjzl.util.MD5Encrypt" %>
<%@ page import="javax.servlet.http.HttpSession" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>

  <head>
  
  	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
  
  	<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/> 
    <link href="css/AeroWindow.css?r=123" rel="stylesheet" type="text/css"/>
    <link href="css/navMenu.css" rel="stylesheet" type="text/css"/>
    <link href="css/top.css" rel="stylesheet" type="text/css"/>
	<link href="css/artDialog/skin/default.css" rel="stylesheet" type="text/css"/>
	<link href="css/artDialog/core/art.dialog[sound_code].css" rel="stylesheet" type="text/css"/>
	<link href="css/prompt/Popup.css" rel="stylesheet" type="text/css" />
	   
    <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script> 
    <script type="text/javascript" src="js/jquery-ui-1.8.1.custom.min.js"></script> 
    <script type="text/javascript" src="js/jquery.easing.1.3.js"></script>         
    <script type="text/javascript" src="js/jquery-AeroWindow.js"></script>
    <script type="text/javascript" src="js/navMenu.js"></script>
    <script type="text/javascript" src="js/artDialog.min.js"></script>
	<script type="text/javascript" src="js/prompt/lanrentuku.js"></script>
    
    <style type="text/css">
    	
	</style>
	
	<script type="text/javascript">
		function checkLogout(){
			art.dialog({
			    lock: true,
			    content: '您确定要离开设计之路IT技术社区吗？',
			    yesText: '确定',
			    noText: '取消',
			    yesFn: function(){
					
			        window.location="http://localhost:8080/sjzl/user_logout";
			        return true;
			    },
			    noFn: true
			});
		}
		function goBack(){
			window.history.back()
		}
		function goForward(){
			window.history.forward()
		}
		$(document).ready(function() {
			$('#click_register_window').click(function() {
				$('#register_window').AeroWindow( {
					WindowTitle : '注册会员',
					WindowPositionTop : 'center',
					WindowPositionLeft : 'center',
					WindowWidth : 720,
					WindowHeight : 430,
					WindowAnimation : 'easeOutCubic',
					WindowResizable : false,
					WindowDraggable : true,
					WindowMinimize : false,
					WindowMaximize : true,
					WindowClosable : true
				});
			});
		});
		$(document).ready(function() {
			$('#click_search_post_window').click(function() {
				$('#search_post_window').AeroWindow( {
					WindowTitle : '搜索主题帖子',
					WindowPositionTop : 'center',
					WindowPositionLeft : 'center',
					WindowWidth : 900,
					WindowHeight : 350,
					WindowAnimation : 'easeOutElastic',
					WindowResizable : false,
					WindowDraggable : true,
					WindowMinimize : false,
					WindowMaximize : true,
					WindowClosable : true
				});
			});
		});
		$(document).ready(function() {
			$('#click_user_info_window').click(function() {
				$('#user_info_window').AeroWindow( {
					WindowTitle : '用户信息',
					WindowPositionTop : 'center',
					WindowPositionLeft : 'center',
					WindowWidth : 600,
					WindowHeight : 350,
					WindowAnimation : 'easeOutElastic',
					WindowResizable : false,
					WindowDraggable : true,
					WindowMinimize : false,
					WindowMaximize : true,
					WindowClosable : true
				});
			});
		});
	</script>
  </head>
  
  <body>
  	
  	<div id="register_window" style="display: none;">
  	  	<iframe src="register.jsp" width="100%" height="100%" style="border: 0px;" frameborder="0"></iframe>
    </div>
  	
    <div class="top_div_1">
    	<span class="top_span_1">
	    	<div style="margin: auto; width: 940px; height: 40px;">
		        <table border="0" height="40px;" style="color: #FFF; font-size: 13px;">
			        <%
			        boolean isLogin = false;//记录用户登陆状态，默认为false
			        String cookieAccount = null;
					String cookieSsid = null;
					if(request.getCookies() != null){
						for(Cookie cookie : request.getCookies()){
							if(cookie.getName().equals("account"))
								cookieAccount = cookie.getValue();
							if(cookie.getName().equals("ssid"))
								cookieSsid = cookie.getValue();
						}
					}
					if(cookieAccount != null && cookieSsid != null){
						//如果加密规则正确, 则视为已经登录
						if(cookieSsid.equals(MD5Encrypt.calcMD5(cookieAccount + MD5Encrypt.getKey()))){
							isLogin = true;
						}
					}
					HttpSession httpSession = request.getSession();
					Object obj = httpSession.getAttribute("sessionUser");
			        if(!isLogin || obj == null){
			        %>
			        	<tr>
			        		
			        		<td>&nbsp;<img src="images/top_img/warn_icon.png"/></td>
			        		<td><span style="color: red;">对不起，您还没有登录！</span></td>
			        		<td>&nbsp;<img src="images/top_img/person_icon.png"/></td>
				            <td><a href="login.jsp">会员登陆</a></td>
				            <td>&nbsp;<img src="images/top_img/person_icon.png"/></td>
				            <td><a id="click_register_window" style="cursor: pointer;" onclick="javascript:scroll(0,0)">注册会员</a></td>
				            <td>&nbsp;<img src="images/top_img/search_icon.png"/></td>
				            <td><a style="cursor: pointer;" id="click_search_post_window" onclick="javascript:scroll(0,0)">打开搜索窗</a></td>
				        </tr>
			        <% }else{ %>
			        	<tr>
				            <td><img src="images/top_img/welcome_icon.png"></img></td>
				            <td>欢迎您：<s:a href="user_myselfInfo?selectAccount=%{#session.sessionUser.account}" >${ cookie.account.value }</s:a></td>
				            <td>&nbsp;<img src="images/top_img/logout_icon.png"/></td>
				            <td><a onclick="checkLogout()" style="cursor: pointer;">注销</a></td>
				            <td>&nbsp;<img src="images/top_img/search_icon.png"/></td>
				            <td><a style="cursor: pointer;" id="click_search_post_window" onclick="javascript:scroll(0,0)">打开搜索窗</a></td>
				            <td>&nbsp;<img src="images/bbs/newMessage_icon.png"></img></td>
				            <td>
				            	<s:a href="user_selectMessageUI?selectAccount=%{#session.sessionUser.account}">消息</s:a>
				            	<s:if test="%{#session.newMessage}">
				            		<span style="color: red;">-- 您有未读的新消息</span>
				            	</s:if>
				            </td>
				        </tr>
			        <% } %>
		       	</table>
		    </div>
    	</span>
    </div>
    
    <div class="top_div_2">
    	<div id="ui_element" class="mh_wrapper">
		    <ul>
		    <li><a href="index.jsp" class="hover">首页</a></li>
		    <li><a href="#">业内资讯</a></li>
		    <li><s:a href="board_list">论坛</s:a></li>
		    <li><a href="#">博客</a></li>
		    <li><a href="#">下载</a></li>
		    <li><a href="#">图书馆</a></li>
		    </ul>
		    <div class="mh_itemMain">鼠标划过展开导航条>></div>
		    <div class="mh_right"></div>
        </div>
        <div class="go_back_div" onclick="goBack()"></div>
        <div class="go_forward_div" onclick="goForward()"></div>
    </div>
    
    <div id="search_post_window" style="display: none;">
    	<div class="search_post_div">
    		<br/><br/><br/>
    		<div style="width: 250px; height: 120px; margin: auto;"><img src="images/sjzl_login_big.png"></img></div>
    		<div style="width: 500px; height: 38px; margin: auto; top: 300px;">
    			<span style="color: white; font-size: 18px;">
    			<s:form action="post_searchPost">
    				搜索主题：<s:textfield cssStyle="width: 300px; height: 22px;" name="query"></s:textfield>
    				<s:submit cssStyle="width: 50px; height: 25px;" value="搜  索"></s:submit>
    			</s:form>
    			</span>
    		</div>
    	</div>
    </div>
    
    <div id="user_info_window" style="display: none;">
    	<iframe src="user/user_index.jsp?pageIndex=user_Information.jsp" width="100%" height="100%" style="border: 0px;" frameborder="0"></iframe>
    </div>
    
    <br/><br/><br/><br/><br/>
  </body>  
</html>